package NGUYENVANDOAN.JDBC_DEMO.CALLABLESTATEMENTS;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

public class CONTROLLERS {
    private final MODELS m_objModels;
    private final Connection m_objConnection;

    public CONTROLLERS(Connection objConnection) {
        m_objConnection = objConnection;
        m_objModels = new MODELS(objConnection);
    }

    public ResultSet getSinhVienAll() throws SQLException {
        return m_objModels.getElements("SELECT MaSV, HoTen, NgaySinh FROM SinhVien");
    }

    public ResultSet getSinhVienProc() throws SQLException {
        return m_objModels.getElementsOfStoreProcedure();
    }

    public ResultSet getSinhVienById(StudentEntity objStudent) 
            throws SQLException {
        return m_objModels.getElementsById(objStudent);
    }
    
    public boolean ThemMonHoc(SubjectEntity objSubject) 
            throws SQLException {
        return m_objModels.ThemMonHoc(objSubject);
    }
}
